<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>正则表达式</title>
</head>

<body>
	
</body>
<script>
	
	str='pp linux and sspnp 2 and 3 and 20 and linox and linax lin x php and LINUX and Php and pap and p2p and paaaaaaaap andp2p linxx is lamp';
	
	arr=str.match(/p.?p/ig); //问号代表0个或1个前边的字符
	alert(arr);
</script>
</html>